/*
 * bldc_smc.h
 *
 *  Created on: Jun 10, 2025
 *      Author: 21954
 */

#ifndef INC_BLDC_SMC_H_
#define INC_BLDC_SMC_H_
#include "main.h"
#include "hpm_bldc_define.h"
#include "hpm_smc.h"
#include "hpm_foc.h"

void set_adval_middle(void);
void bldc_init_par(void);
void motor0_highspeed_loop(void);

#define PWM_RELOAD                  (2000)

#define MOTOR0_SPD                  (15)
#define BLDC_ANGLE_SET_TIME_MS      (2000)
#define BLDC_CURRENT_SET_TIME_MS    (200)
#define SENSORLESS_TMR_RELOAD       (10)

typedef struct motor0_par {
    BLDC_CONTROL_FOC_PARA       foc_para;
    hpm_mcl_para_t       		smc_para;
    hpm_smc_pll_para_t          smc_pll;
    BLDC_CONTRL_PID_PARA        speedloop_para;
    void (*adc_trig_event_callback)(void);
} MOTOR0_PARA;



extern volatile uint8_t timer_flag;
extern int16_t drag_angle;
extern uint8_t is_being_started;

extern MOTOR0_PARA motor0;
extern BLDC_CONTRL_SPD_PARA        pll_speed_control;

#endif /* INC_BLDC_SMC_H_ */
